//获取应用实例
const app = getApp();
import config from '../../utils/config.js';
import {Request} from '../../utils/request.js';

Page({
  data: {
    loading: false,
    list: [],
    totalPage: 0,
    curPage: 1,
    loadingPage: false,
    lastPage: false,
    cardAd: {},
    itemAd: {},
  },


  loadingSuccess() {
    this.setData({
      loading: true,
    })
  },

  onLoad: function () {
    this.getData();
    if(app.callBack) {
      this.getData();
    }else {
      app.callBack = this.getData;
    }
    
  },


  getData: function() {
    // this.getLotteryList();
  },
  



  //加载更多
  onReachBottom: function () {
    let that = this;
    if(that.data.curPage == that.data.totalPage || that.data.loadingPage) {
      return ;
    }
    that.setData({
      curPage: that.data.curPage + 1,
      loadingPage: true,
    })
    that.postLotteryItem();
  },

  //顶部的功能
  onTopFun: function(e) {

    let type = e.currentTarget.dataset.type
    if(type == 'signin') {
      wx.showModal({
        title: '提示',
        content: '该功能暂不开源',
      })
    }else if(type == 'activity') {
      wx.navigateTo({
        url: '/pages/activity/lottery/lottery',
      })
    }

  },

  onShareAppMessage: function () {
    return app.shareAppMessage();
  }


})
